"""字段配置Service"""
from typing import List
from sqlalchemy.orm import Session
from app.repositories.field_config_repository import FieldConfigRepository
from app.models.field_config import FieldConfig


class FieldConfigService:
    """字段配置业务逻辑层"""

    def __init__(self, db: Session):
        self.repository = FieldConfigRepository(db)

    def get_by_task_id(self, task_id: int) -> List[FieldConfig]:
        """根据任务ID获取字段配置列表"""
        return self.repository.get_by_task_id(task_id)

    def get_by_category(self, task_id: int, category: str) -> List[FieldConfig]:
        """根据任务ID和字段分类获取配置列表"""
        return self.repository.get_by_category(task_id, category)

    def get_by_field_name(self, task_id: int, field_name: str):
        """根据任务ID和字段名获取配置"""
        return self.repository.get_by_field_name(task_id, field_name)

